package repos

import (
	asImpl "go2o/core/domain/after-sales"
	afterSales "go2o/core/domain/interface/after-sales"
	"go2o/core/domain/interface/payment"

	"github.com/ixre/gof/db"
)

var _ afterSales.IAfterSalesRepo = new(afterSalesRepo)

type afterSalesRepo struct {
	db.Connector
	orderRepo   order.IOrderRepo
	memberRepo  member.IMemberRepo
	paymentRepo payment.IPaymentRepo
}

func NewAfterSalesRepo(conn db.Connector, orderRepo order.IOrderRepo,
	memberRepo member.IMemberRepo, paymentRepo payment.IPaymentRepo) afterSales.IAfterSalesRepo {
	return &afterSalesRepo{
		Connector:   conn,
		orderRepo:   orderRepo,
		memberRepo:  memberRepo,
		paymentRepo: paymentRepo,
	}
}

func (a *afterSalesRepo) CreateAfterSalesOrder(v *afterSales.AfterSalesOrder) afterSales.IAfterSalesOrder {
	return asImpl.NewAfterSalesOrder(v, a, a.orderRepo, a.memberRepo, a.paymentRepo)
}
